home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Performance Co-Pilot 1.3
/
SGI Performance Co-Pilot 1.3.iso
/
dist
/
pcp.idb
/
usr
/
pcp
/
lib
/
pmview-args.z
/
pmview-args
Wrap
Text File
|
1997-04-03
|
6KB
|
248 lines
#
# Copyright (c) 1994 Silicon Graphics, Inc.
# ALL RIGHTS RESERVED.
#
# U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND
# Use, duplication or disclosure by the Government is subject to
# restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph
# (c)(1)(ii) of the Rights in Technical Data and Computer Software clause
# at DFARS 252.227-7013 and/or similar or successor clauses in the FAR,
# or the DOD or NASA FAR Supplement. Contractor/manufacturer is Silicon
# Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
#
# THIS SOFTWARE CONTAINS CONFIDENTIAL AND PROPRIETARY INFORMATION OF
# SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, DISTRIBUTION, OR
# DISCLOSURE IS STRICTLY PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN
# PERMISSION OF SILICON GRAPHICS, INC.
# /
#
# $Id: pmview-args,v 2.3 1997/03/26 03:21:13 kenmcd Exp $
#
prog=`basename $0`
#
# Standard usage and command-line argument parsing for pmview front ends.
# This file should be included by pmview front end scripts to present a
# consistent interface. See pmview(1), dkvis(1), mpvis(1) and nfsvis(1)
# for more information on their respective interfaces.
#
#
# The front end scripts should call _pmview_usage after their own usage
# information in a subroutine called _usage. The _usage subroutine may be
# called by either _pmview_usage or _pmview_args.
#
_pmview_usage()
{
echo '
-A align align sample time to natural boundaries
-a archive metrics source is an archive log
-C check configuration file and exit
-h host metrics source is PMCD on host
-n namespace use an alternative PMNS
-O time initial sample time origin
-p port time control port
-S time start sample time
-t interval sample interval in seconds(float) [default 1.0]
-T time terminate sample time
-z set reporting timezone to local time for host from -a or -h
-Z timezone set reporting timezone
-display display-string
-title title-string
-geometry geometry-string
-name name-string
-xrm resource [-xrm ..]'
}
#
# One of the first actions of a front end script should be to call
# _pmview_args. It sets the following variables:
#
# host the host specified with -h.
# arch the first archive specified with -a (other archives are
# passed on to pmview).
# args The list of args that pmview will comprehend and use.
# otherArgs The arguments pmview will not understand and should be
# handled by the front end script.
# titleArg The title the user prefers. If empty, the title should be
# provided by the front end script.
# prog The name of the program.
# namespace The namespace (including the flag) if specified, else empty
# eg "-n foo"
#
_pmview_args()
{
host=""
arch=""
args=""
otherArgs=""
titleArg=""
namespace=""
while [ $# -gt 0 ]
do
case $1
in
-g*|-d*|-name|-xrm)
# assume an X11 argument
if [ $# -lt 2 ]
then
echo "$prog: $1 requires one argument"
_usage
exit 1
fi
args="$args $1 '$2'"
shift
;;
-title)
# assume an X11 argument
if [ $# -lt 2 ]
then
echo "$prog: $1 requires one argument"
_usage
exit 1
fi
titleArg="$2"
shift
;;
-A|-D|-O|-p|-S|-T|-t|-Z)
if [ $# -lt 2 ]
then
echo "$prog: $1 requires one argument"
_usage
exit 1
fi
args="$args $1 '$2'"
shift
;;
-A*|-D*|-O*|-p*|-S*|-T*|-t*|-Z*|-C|-z)
args="$args $1"
;;
-a)
if [ "X$host" != X ]
then
echo "$prog: only one of -h or -a maybe specified"
_usage
exit 1
fi
if [ $# -lt 2 ]
then
echo "$prog: $1 requires one argument"
_usage
exit 1
fi
if [ "X$arch" = X ]
then
arch=$2
fi
args="$args -a $2"
shift
;;
-h)
if [ "X$arch" != X -o "X$host" != X ]
then
echo "$prog: only one of -h or -a maybe specified"
_usage
exit 1
fi
if [ $# -lt 2 ]
then
echo "$prog: $1 requires one argument"
_usage
exit 1
fi
host=$2
args="$args -h $2"
shift
;;
-n)
if [ $# -lt 2 ]
then
echo "$prog: $1 requires one argument"
_usage
exit 1
fi
namespace="-n $2"
args="$args -n $2"
shift
;;
*)
otherArgs="$otherArgs $1"
;;
esac
shift
done
}
# standard fatal error reporting
# Usage: _pmview_error message goes in here
# _pmview_error -f file
#
_pmview_error()
{
_pmview_note Error error $*
}
# standard warning
# Usage: _pmview_warning message goes in here
# _pmview_warning -f file
#
_pmview_warning()
{
_pmview_note Warning warning $*
}
# standard info
# Usage: _pmview_info message goes in here
# _pmview_info -f file
#
_pmview_info()
{
_pmview_note Info info $*
}
# generic notifier
# Usage: _pmview_note tag icon args ...
#
_pmview_note()
{
tag=$1; shift
icon=$1; shift
button=""
[ $tag = Error ] && button="-B Quit"
if [ -z "$DISPLAY" -o "${PCP_USE_STDERR+yes}" = yes ]
then
if [ $# -eq 2 -a "X$1" = X-f ]
then
echo "$prog: $tag: ..."
cat $2
else
echo "$prog: $tag: $*"
fi
else
if [ $# -eq 2 -a "X$1" = X-f ]
then
/usr/bin/X11/xconfirm -icon $icon -file $2 -useslider -header "$tag $prog" $button >/dev/null 2>&1
else
/usr/bin/X11/xconfirm -icon $icon -t "$*" -noframe -header "$tag $prog" $button >/dev/null 2>&1
fi
fi
[ $tag = Error ] && exit 1
}